package com.zl.tesseract.scanner.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.zl.tesseract.R;


/**
 * 单号编辑dialog.
 * @author: zhangyan
 * @date: 2018/8/5
 */
public class OrderIdEditDialog extends Dialog {

    Context mContext;
    private TextView positiveButton;
    private TextView negativeButton;
    private EditText edt_content;

    public OrderIdEditDialog(@NonNull Context context) {
        super(context, R.style.Dialog);
        this.mContext = context;
        initView();    }

    public OrderIdEditDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        this.mContext = context;
        initView();
    }


    //初始化
    public void initView() {
        View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_order_id_edit, null);
        edt_content = view.findViewById(R.id.edt_content);
        positiveButton = view.findViewById(R.id.positiveButton);
        negativeButton = view.findViewById(R.id.negativeButton);

        super.setContentView(view);
    }


    //获取当前输入框对象
    public String getEditText() {
        return edt_content.getText().toString().trim();
    }

    //确定键监听器
    public void setOnSureListener(View.OnClickListener listener) {
        positiveButton.setOnClickListener(listener);
    }

    //取消键监听器
    public void setOnCanlceListener(View.OnClickListener listener) {
        negativeButton.setOnClickListener(listener);
    }

}